package cms

import (
	"gitcode.com/G-YT/baoyou/server/middleware"
	"github.com/gin-gonic/gin"
)

type CategoryRouter struct{}

// InitCategoryRouter 初始化 分类 路由信息
func (s *CategoryRouter) InitCategoryRouter(Router *gin.RouterGroup, PublicRouter *gin.RouterGroup) {
	catRouter := Router.Group("cat").Use(middleware.OperationRecord())
	catRouterWithoutRecord := Router.Group("cat")
	catRouterWithoutAuth := PublicRouter.Group("cat")
	{
		catRouter.POST("createCategory", catApi.CreateCategory)             // 新建分类
		catRouter.DELETE("deleteCategory", catApi.DeleteCategory)           // 删除分类
		catRouter.DELETE("deleteCategoryByIds", catApi.DeleteCategoryByIds) // 批量删除分类
		catRouter.PUT("updateCategory", catApi.UpdateCategory)              // 更新分类
	}
	{
		catRouterWithoutRecord.GET("findCategory", catApi.FindCategory)       // 根据ID获取分类
		catRouterWithoutRecord.GET("getCategoryList", catApi.GetCategoryList) // 获取分类列表
	}
	{
		catRouterWithoutAuth.GET("getCategoryPublic", catApi.GetCategoryPublic) // 分类开放接口
	}
}
